package by.btn.stripes;

import net.sourceforge.stripes.action.ForwardResolution;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.config.Configuration;
import net.sourceforge.stripes.exception.DefaultExceptionHandler;
import net.sourceforge.stripes.exception.ExceptionHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by IntelliJ IDEA.
 * User: Alex
 * Date: 12.06.2011
 * Time: 10:18:11
 * To change this template use File | Settings | File Templates.
 */
public class BtnExceptionHandler implements ExceptionHandler {

    private static final String VIEW = "/WEB-INF/jsp/technical/exception.jsp";

    public void handle(Throwable exc, HttpServletRequest req,
                               HttpServletResponse resp) throws ServletException {
        try {
            req.getRequestDispatcher(VIEW).forward(req, resp);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void init(Configuration configuration) throws Exception {
    }
}
